import json
import socket



request = json.dumps({
    "header": {
        "type": 10
    },
    "body": {
        "command": "dir"
    }
})


sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 9090))
sock.listen(1)

conn, _ = sock.accept()

conn.send(request.encode())

data = conn.recv(1024)
conn.close()

json_data = json.loads(data.decode())
print(json_data["body"]["response"])
